<template>
  <el-dialog
    title="请选择提交方式"
    :visible.sync="dialogVisible"
    width="350px"
    top="40%">
    <div>
      <el-radio-group v-model="submitType">
        <el-radio :label="0">订单提交</el-radio>
        <el-radio :label="1" :disabled="!isBinding">
          {{ isBinding?'采购单提交(已绑定店铺)':'采购单提交(未绑定店铺)' }}
        </el-radio>
      </el-radio-group>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="confirm">确认选择</el-button>
    </div>
  </el-dialog>

</template>

<script>
export default {
  name: 'CartSubmitDialog',
  data: function () {
    return {
      callback: null,
      dialogVisible: false,
      isBinding: false,
      submitType: 0
    }
  },
  mounted () {
    let $this = this
    $this.bus.$on('CartSubmitDialogCallBus', function (isBinding,callback) {
      $this.dialogVisible = true
      $this.isBinding = isBinding
      $this.submitType = 0
      $this.callback = callback
      $this.$forceUpdate()
    })

  },
  methods: {
    confirm: function () {
      if (typeof this.callback === 'function') {
        this.callback(this.submitType)
        this.dialogVisible = false
      }
    }
  }
}
</script>

<style scoped>

</style>
